<?php

namespace App\Http\Middleware\Admin;
use Closure;
use App\Http\Models\Admin\Node;
use Illuminate\Support\Facades\View;
class MkBreadcurmb
{
    public function handle($request, Closure $next)
    {
		$cur_uri = explode('admin/',$request->path())[1];
		if($cur_uri != ''){
			$nowNode = Node::where('src',$cur_uri)->first();
			$pNode = Node::where('id',$nowNode->pid)->first();
			View::share('nowNode',$nowNode);
			View::share('pNode',$pNode);
		}
        return $next($request);
    }
}
